[NASM] How do I print out the content of a register in Hex
Posted
by Johnny ASM
on Stack Overflow
See other posts from Stack Overflow
or by Johnny ASM
Published on 2010-06-07T18:17:41Z
Indexed on
2010/06/07
18:22 UTC
Read the original article
Hit count: 290
Hi,
I'm currently getting started with NASM and wanted to know, how to output the contents of a register with NASM in Hexadecimal. I can output the content of eax with
section .bss
reg_buf: resb 4
.
.
.
print_register:
mov [reg_buf], eax
mov eax, SYS_WRITE
mov ebx, SYS_OUT
mov ecx, reg_buf
mov edx, 4
int 80h
ret
Let's say eax contains 0x44444444 then the output would be "DDDD". Apparently each pair of "44" is interpreted as 'D'. My ASCII table approves this.
But how do I get my program to output the actual register content (0x44444444)?
© Stack Overflow or respective owner